package com.api.predict.service;

import com.api.core.service.Service;
import com.api.predict.form.CreatePredictForm;
import com.api.predict.model.Predict;
import com.api.predict.vo.PredictRegistrationVo;
import com.api.predict.vo.PredictResultVo;
import com.api.predict.vo.PredictTeamVo;
import com.api.predict.vo.PredictVo;
import com.api.user.exception.CoinChangedException;
import com.github.pagehelper.PageInfo;

import java.util.List;
import java.util.Map;

/**
 * @author RenQiang
 * @date 2021/6/5
 */
public interface PredictService extends Service<Predict> {
    /**
     * 分页查询竞猜列表
     *
     * @param queryParams 查询参数
     * @param orderParams 排序参数
     * @param pageNum     页号
     * @param pageSize    分页大小
     * @return
     */
    PageInfo<PredictVo> listByPage(Map<String, Object> queryParams, Map<String, String> orderParams, Integer pageNum, Integer pageSize);

    /**
     * 竞猜下注
     *
     * @param userId
     * @param predictId
     * @param predictTeamIds
     */
    void registry(Long userId, Long predictId, List<Long> predictTeamIds) throws CoinChangedException;

    /**
     * 创建竞猜
     *
     * @param form
     */
    void createNewPredict(CreatePredictForm form);

    /**
     * 结束竞猜
     *
     * @param predictId
     * @param victoryTeamIds
     */
    void complete(Long predictId, List<Long> victoryTeamIds) throws CoinChangedException;

    /**
     * 获取竞猜战队列表
     *
     * @param predictId
     * @return
     */
    List<PredictTeamVo> getPredictTeams(Long predictId);

    /**
     * 获取竞猜参与者列表
     *
     * @param predictId
     * @return
     */
    List<PredictRegistrationVo> getPredictRegistrations(Long predictId);

    /**
     * 获取竞猜结果
     *
     * @param predictId
     * @param userId
     * @return
     */
    PredictResultVo getPredictResult(Long predictId, Long userId);

    /**
     * Delete predict by id
     *
     * @param predictId
     */
    void deletePredict(Long predictId);

    /**
     * Update predict
     *
     * @param form
     */
    void updatePredict(CreatePredictForm form);
}
